<?php
namespace Admin\Controller;
use Think\Controller;
class XtmessageController extends Controller
{
    public function index()
    {
        $this->display();
       
    }

    /*反馈信息*/
    public function xtmessagelist(){
        $xtmessage = M('xtmessage');
        $xtmessagelist = $xtmessage->order("xtmid asc")->field('xtmid,xtmtitle,xtmess,xtmdate')->select();

        for($index=0;$index<count($xtmessagelist);$index++)
        {
            $xtmessageist[$index]['number']=$index+1;
        }

        $this->assign('xtmessagelist',$xtmessagelist);
        $this->display();
    }

     public function delxtmessage()
    {
        $xtmid=I('xtmid');
        $xtmessagesModel = M('xtmessage');
        $xtmessage=$xtmessagesModel->where("xtmid=$xtmid")->find();
        // unlink(realpath("./Public/Uploads/logo/".$user["photo"]));
        if($xtmessagesModel->delete($xtmid)) {
            $this->success('删除成功');
        }
        else {
            $this->error('删除失败');
        }
           
    }




    /*培训删除*/
    // public function delxtmessage( )
    // {

    //     $xtmid=I('xtmid');
    //     $xtmessage = M('xtmessage');//实例化news对象
    //     if($xtmessage->delete($xtmid)) {
    //         $this->success('删除成功');
    //     }
    //     else {
    //         $this->error('删除失败');
    //     }
    // }

   
    


    public function addxtmessage(){
        $this->display();
    }  
        public function newxtmessage(){
        $m = M("xtmessage");
        $m->xtmtitle=I('post.xtmtitle');
        $m->xtmess=I('post.xtmess');
        $m->xtmdate=I('post.xtmdate');
        // $m->clubid = $_SESSION['clubid'];
        if(false!=$m->add()){
            $this->redirect('Xtmessage/xtmessagelist','',2,'添加成功，页面跳转中...');
        }else{
            $this->error("添加失败！");
        }
    }
}